﻿<Window x:Class="DarkLight.WpfTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:media="clr-namespace:System.Windows.Media.Media3D10;assembly=System.Windows.Media.Media3D10"
        xmlns:dm="clr-namespace:DarkLight.Model;assembly=DarkLight"
        xmlns:dc="clr-namespace:DarkLight.Controls;assembly=DarkLight"
        xmlns:my="clr-namespace:DarkLight.WpfTest"
        Title="MainWindow" Height="600" Width="800">
    <Grid Margin="5" >
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Rectangle Fill="Black" />
        <dc:ViewPort x:Name="viewPort" >
            <dc:ViewPort.Resources>
                <Storyboard x:Key="cameraRotationStoryboard" Duration="0:0:1" >
                    <SingleAnimation To="0" Storyboard.TargetName="cameraRot" Storyboard.TargetProperty="Yaw" IsAdditive="True" />
                    <SingleAnimation To="0" Storyboard.TargetName="cameraRot" Storyboard.TargetProperty="Roll" IsAdditive="True" />
                    <SingleAnimation To="0" Storyboard.TargetName="cameraZoom" Storyboard.TargetProperty="ScaleX" />
                    <SingleAnimation To="0" Storyboard.TargetName="cameraZoom" Storyboard.TargetProperty="ScaleY" />
                    <SingleAnimation To="0" Storyboard.TargetName="cameraZoom" Storyboard.TargetProperty="ScaleZ" />
                </Storyboard>
            </dc:ViewPort.Resources>
            <dc:ViewPort.Light>
                <media:PointLight Position="0 0 0" />
            </dc:ViewPort.Light>
            <dc:ViewPort.Skybox>
                <media:SkyboxModel3D10 Effect="/DarkLight.WpfTest;component/Shaders/Skybox.fx" EffectTechnique="Render" >
                    <media:SkyboxModel3D10.Map>
                        <media:CubeMap>
                            <media:CubeMap.BackBrush>
                                <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/skybox_back.png" />
                            </media:CubeMap.BackBrush>
                            <media:CubeMap.BottomBrush>
                                <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/skybox_bottom.png" />
                            </media:CubeMap.BottomBrush>
                            <media:CubeMap.FrontBrush>
                                <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/skybox_front.png" />
                            </media:CubeMap.FrontBrush>
                            <media:CubeMap.LeftBrush>
                                <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/skybox_left.png" />
                            </media:CubeMap.LeftBrush>
                            <media:CubeMap.RightBrush>
                                <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/skybox_right.png" />
                            </media:CubeMap.RightBrush>
                            <media:CubeMap.TopBrush>
                                <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/skybox_top.png" />
                            </media:CubeMap.TopBrush>
                        </media:CubeMap>
                    </media:SkyboxModel3D10.Map>
                    <media:SkyboxModel3D10.EffectParameters>
                        <media:CommonMatrixEffectParameter ApplyViewProjectionMatrix="True" />
                    </media:SkyboxModel3D10.EffectParameters>
                </media:SkyboxModel3D10>
            </dc:ViewPort.Skybox>
            <dc:ViewPort.Camera>
                <media:Camera Width="{Binding ElementName=viewPort, Path=ActualWidth, Mode=OneWay}"
                              Height="{Binding ElementName=viewPort, Path=ActualHeight, Mode=OneWay}"
                              Eye="50 0 0"
                              Target="60 0 0"
                              dc:ViewPort.MinZoom="5"
                              dc:ViewPort.MaxZoom="50"
                              NearPlaneDistance="1.0" FarPlaneDistance="1000" >
                    <media:Camera.Transform>
                        <media:Transform3D10Group>
                            <media:ScaleTransform3D10 x:Name="cameraZoom" ScaleX="5" ScaleY="5" ScaleZ="5" />
                            <media:RotateTransform3D10>
                                <media:RotateTransform3D10.Rotation>
                                    <media:SphericalRotation3D10 x:Name="cameraRot" Yaw="0" Pitch="0" Roll="150" />
                                </media:RotateTransform3D10.Rotation>
                            </media:RotateTransform3D10>
                        </media:Transform3D10Group>
                    </media:Camera.Transform>
                </media:Camera>
            </dc:ViewPort.Camera>
            <media:ModelVisual3D10>
                <media:ModelVisual3D10.Content>
                    <media:EllipseModel3D10 Radius="{Binding Path=sdmfqlkkj}" Divisions="128" Eccentricity="0.0" EffectTechnique="Render" 
                                                Effect="/DarkLight.WpfTest;component/Shaders/Trajectory.fx" >
                        <media:EllipseModel3D10.Brush>
                            <LinearGradientBrush>
                                <GradientStop Offset="0.0" Color="White" />
                                <GradientStop Offset="0.75" Color="Transparent" />
                                <GradientStop Offset="1" Color="Transparent" />
                            </LinearGradientBrush>
                        </media:EllipseModel3D10.Brush>
                        <media:EllipseModel3D10.EffectParameters>
                            <media:CommonMatrixEffectParameter ApplyWorldViewProjectionMatrix="True" />
                        </media:EllipseModel3D10.EffectParameters>
                    </media:EllipseModel3D10>
                </media:ModelVisual3D10.Content>
                <media:ModelVisual3D10>
                    <media:ModelVisual3D10.Transform>
                        <media:TranslateTransform3D10 OffsetX="60" OffsetY="0" OffsetZ="0" />
                    </media:ModelVisual3D10.Transform>
                    <media:ModelVisual3D10.Content>
                        <media:Model3D10Group>
                            <media:SphereModel3D10 Radius="10" TesselationLevel="6" EffectTechnique="Render"
                                               Effect="/DarkLight.WpfTest;component/Shaders/Planet.fx" >
                                <media:SphereModel3D10.Materials>
                                    <media:DiffuseMaterial Opacity="1">
                                        <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/Earth_Diffuse.png" />
                                    </media:DiffuseMaterial>
                                    <media:GlowMaterial>
                                        <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/Earth_Glow.png" />
                                    </media:GlowMaterial>
                                    <media:BumpMaterial>
                                        <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/Earth_Bump.png" />
                                    </media:BumpMaterial>
                                    <media:SpecularMaterial PhongExponent="50" PhongCoefficient="5" >
                                        <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/Earth_Specular.png" />
                                    </media:SpecularMaterial>
                                    <media:CloudsMaterial Opacity="1" Height="0.01" RevolutionTime="00:01:00" >
                                        <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/Earth_Clouds.png" />
                                    </media:CloudsMaterial>
                                    <media:AtmosphereMaterial InnerRadius="10" OuterRadius="10.5" >
                                        <SolidColorBrush Color="Blue" />
                                    </media:AtmosphereMaterial>
                                </media:SphereModel3D10.Materials>
                                <media:SphereModel3D10.EffectParameters>
                                    <media:CommonMatrixEffectParameter ApplyProjectionMatrix="True" ApplyViewMatrix="True" ApplyWorldMatrix="True" 
                                                               ApplyWorldViewMatrix="True" ApplyWorldViewProjectionMatrix="True" />
                                    <media:LightPositionEffectParameter ApplyLocalPosition="True" ApplyWorldPosition="True" ApplyViewPosition="True" />
                                    <media:CameraPositionEffectParameter ApplyLocalPosition="True" ApplyWorldPosition="True" />
                                    <media:GameTimeParameter />
                                </media:SphereModel3D10.EffectParameters>
                            </media:SphereModel3D10>
                            <media:SpriteModel3D10 Width="10" Height="10" EffectTechnique="Render"
                                               Effect="/DarkLight.WpfTest;component/Shaders/Sprite.fx">
                                <media:SpriteModel3D10.EffectParameters>
                                    <media:CommonMatrixEffectParameter ApplyWorldViewMatrix="True" ApplyProjectionMatrix="True" />
                                </media:SpriteModel3D10.EffectParameters>
                                <media:SpriteModel3D10.Brush>
                                    <ImageBrush ImageSource="/DarkLight.WpfTest;component/Resources/planet.png" />
                                </media:SpriteModel3D10.Brush>
                            </media:SpriteModel3D10>
                        </media:Model3D10Group>
                    </media:ModelVisual3D10.Content>
                    <media:ModelVisual3D10>
                        <media:ModelVisual3D10.Content>
                            <media:EllipseModel3D10 Radius="20" Divisions="128" Eccentricity="0.3" EffectTechnique="Render" 
                                                    Effect="/DarkLight.WpfTest;component/Shaders/Trajectory.fx" >
                                <media:EllipseModel3D10.Brush>
                                    <LinearGradientBrush>
                                        <GradientStop Offset="0.0" Color="White" />
                                        <GradientStop Offset="0.75" Color="Transparent" />
                                        <GradientStop Offset="1" Color="Transparent" />
                                    </LinearGradientBrush>
                                </media:EllipseModel3D10.Brush>
                                <media:EllipseModel3D10.EffectParameters>
                                    <media:CommonMatrixEffectParameter ApplyWorldViewProjectionMatrix="True" />
                                </media:EllipseModel3D10.EffectParameters>
                            </media:EllipseModel3D10>
                        </media:ModelVisual3D10.Content>
                    </media:ModelVisual3D10>
                </media:ModelVisual3D10>
            </media:ModelVisual3D10>
        </dc:ViewPort>
        <StackPanel Grid.Row="2" Margin="0,5,0,0" Orientation="Horizontal" >
            <TextBlock Text="FPS:" />
            <TextBlock Margin="5,0,0,0" 
                       Text="{Binding Path=Fps, Mode=OneWay}" />
        </StackPanel>
    </Grid>
</Window>
